home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-09 | 1.7 KB | 117 lines | [TEXT/MPS ] |
-
- //%%DOC: MainLoop.c.Trivial -- begin
-
-
- void Init(void);
- void MainLoop (void);
- void DoMouseDown (EventRecord *event);
-
- void Init()
- {
- MaxApplZone();
-
- InitGraf(&thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(0L);
- InitCursor();
- FlushEvents(everyEvent, 0);
- %IF.TRIVIAL.RES MBAR
- DoMakeMenus ();
- %END.TRIVIAL
-
- //%% >> add another initialization here <<
-
- }/* end Init */
-
-
- void MainLoop ()
- {
- RgnHandle cursorRgn;
- Boolean gotEvent,quit;
- EventRecord event;
- char key;
-
- cursorRgn = NewRgn(); // Pass empty region 1st time thru
-
- gotEvent = false;
- quit = false;
- while ( quit == false )
- {
- gotEvent = WaitNextEvent(everyEvent, &event, 15,cursorRgn);
- if (gotEvent)
- switch (event.what)
- {
- case mouseDown:
- DoMouseDown(&event);
- break;
-
- case keyDown:
- case autoKey:
- key = (event.message & charCodeMask);
- if ((event.modifiers & cmdKey) != 0)
- {
- /*%% >> <<*/;
- }
- break;
-
- case updateEvt:
- {
- /*%% >> <<*/;
- }
- break;
-
- case activateEvt:
- {
- /*%% >> <<*/;
- }
- break;
- }
-
- }
- DisposeRgn(cursorRgn);
- }/* end MainLoop */
-
-
- void DoMouseDown (EventRecord *event)
- {
- WindowPtr theWindow;
- int windowCode = FindWindow (event->where, &theWindow);
-
- switch (windowCode)
- {
- case inSysWindow:
- SystemClick (event, theWindow);
- break;
-
- %IF.TRIVIAL.RES MBAR
- case inMenuBar:
- DoMenuCommand(event);
- break;
- %END.TRIVIAL
-
- case inDrag:
- /*%% >> <<*/
- break;
-
- case inContent:
- /*%% >> <<*/
- break;
-
- case inGoAway:
- /*%% >> <<*/
- break;
- }
- }/* end DoMouseDown */
-
- void main( void )
- {
- Init();
- MainLoop();
- } /* end main */
-
-
- //%%DOC: MainLoop.c.Trivial -- eof
-